<template>
  <ul v-for="name in names" :key="name">
    <li v-text="name"></li>
  </ul>
  <!--  第一个参数是列表元素 第二个参数是列表索引 -->
  <ul v-for="(name,index) in names" :key="name + index">
    <li v-text="names[index]"></li>
  </ul>
  <!--  第一个参数是对象属性值 第二个参数是对象属性名 -->
  <div v-for="(value,field) in person" v-text="field +' : '+ value" :key="field +' : '+ value"></div>
  <table align="center">
    <tbody>
      <tr v-for="person in persons" :key="person.id">
        <td v-text="person.id"></td>
        <td v-text="person.name"></td>
        <td v-text="person.age"></td>
        <td v-text="person.gender == true ? '精神小伙儿' : '扒蒜老妹儿'"></td>
      </tr>
    </tbody>
  </table>
</template>

<script>

export default {
  name: 'App',
  data() {
    return {
      names: ['李昊哲', '大美丽', '李胜龙', '小可爱'],
      person: {
        name: '李昊哲',
        age: 39,
        gender: true,
      },
      persons: [{
        id: 1,
        name: '李昊哲',
        age: 35,
        gender: true,
      }, {
        id: 2,
        name: '大美丽',
        age: 39,
        gender: false,
      }, {
        id: 3,
        name: '李胜龙',
        age: 39,
        gender: true,
      }, {
        id: 4,
        name: '小可爱',
        age: 27,
        gender: false,
      }]
    }
  }
}
</script>

<style>

ul > li {
  list-style: none;
}

.box {
  border-radius: 50%;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
